package com.yoso.thread.call;

import com.yoso.domain.User;
import com.yoso.thread.MyThreadPool;

import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;

/**
 * @author shizejin
 * @date 2022/1/29
 * @description:
 */
public class Test {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ExecutorService executorService = MyThreadPool.getInstance();
        Future<List<User>> future = executorService.submit(new CallThread());
        System.out.println("future.isDone() = " + future.isDone());
        System.out.println("future.isCancelled() = " + future.isCancelled());
        while (!future.isDone()){}
        System.out.println("future.isDone() = " + future.isDone());
        List<User> list = future.get();
        System.out.println(list);
    }
}
